﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using BCDataCenter.DataAccessLayer;
/// <summary>
/// Summary description for BWTableMis
/// </summary>
namespace BCDataCenter.BOL
{
    public class BWTableMis
    {
        string SqlInsert = "TableMisInsert";
        string SqlUpdate = "TableMisUpdate";
        string SqlGetData = "TableMisGetList";
        string SqlIsExistSitecode = "IsExistSitecode";
        public BWTableMis()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        public bool Insert(ref string error, string SiteCode, string SiteName, string Address, string Tel, bool Active)
        {
            return new DAL().MyExecuteNonQuery(SqlInsert,System.Data.CommandType.StoredProcedure,ref error,
                new SqlParameter("@Sitecode",SiteCode),
                new SqlParameter("@sitename",SiteName),
                new SqlParameter("@Address",Address),
                new SqlParameter("@Tel",Tel),
                new SqlParameter("@Active",Active)
                );
        }

        public bool Update(ref string error, string SiteCode, string SiteName, string Address, string Tel, bool Active)
        {
            return new DAL().MyExecuteNonQuery(SqlUpdate, System.Data.CommandType.StoredProcedure, ref error,
                new SqlParameter("@Sitecode", SiteCode),
                new SqlParameter("@sitename", SiteName),
                new SqlParameter("@Address", Address),
                new SqlParameter("@Tel", Tel),
                new SqlParameter("@Active", Active)
                );
        }
        public bool IsExistMaTTPP(ref string error, string Sitecode)
        {
            return new DAL().IsExistFromSQL(SqlIsExistSitecode, System.Data.CommandType.StoredProcedure, ref error, new SqlParameter("@Sitecode", Sitecode));
        }
        public System.Data.DataSet dsList(ref string error)
        {
            return new DAL().MyExecuteReader(ref error, SqlGetData, System.Data.CommandType.StoredProcedure);
        }    
    }
}
